﻿using SqlSugar;
using System.Diagnostics.SymbolStore;

namespace AppServices.User.Dto
{
    public class UserInfoOutput
    {
        ///// <summary>
        ///// 编号
        ///// 主键 必填 自增长
        ///// 默认值 0
        ///// </summary>     
        //[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "编号")]
        //public long Id { get; set; }

        /// <summary>
        /// 用户名
        /// 必填
        /// 默认值 null
        /// </summary>           
        [SugarColumn(IsNullable = false, ColumnDescription = "用户名")]
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// 必填
        /// 默认值 null
        /// </summary>           
        [SugarColumn(IsNullable = false, ColumnDescription = "密码")]
        public string Pwd { get; set; }

        /// <summary>
        /// 电话
        /// 必填
        /// 默认值 null
        /// </summary>           
        [SugarColumn(IsNullable = true, ColumnDescription = "电话")]
        public string Mobile { get; set; }

        /// <summary>
        /// 邮箱
        /// 必填
        /// 默认值 null
        /// </summary>           
        [SugarColumn(IsNullable = true, ColumnDescription = "邮箱")]
        public string Email { get; set; }

        /// <summary>
        /// 状态 1 可用，-1 禁用
        /// 必填
        /// 默认值 0
        /// </summary>           
        [SugarColumn(IsNullable = false, DefaultValue = "1", ColumnDescription = "状态")]
        public int Status { get; set; }

        [SugarColumn(IsIgnore = true)]
        public bool IsEnable
        {
            get
            {
                if (Status == -1)
                    return false;
                else if (Status == 1)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            set
            {
                if (value == true)
                    Status = 1;
                else
                {
                    Status = 0;
                }
            }
        }

    }
}
